#include <stdio.h>

int devide(int a) {
    int cut,max=0;
    scanf("%d",&cut);
    int arr[cut+1],in[cut+1];
    in[0]=0;
    for(int i=0;i<cut;i++) {   //in:0 1 2 4
        scanf("%d",&in[i+1]);
        arr[i]=in[i+1]-in[i]; //arr:1 1 2 1
        max=max>arr[i] ? max : arr[i];
    }
    arr[cut]=a-in[cut];
    return (max>arr[cut]) ? max : arr[cut];
}
int main() {
    int h,w;
    scanf("%d%d",&h,&w);
    int y=devide(h);
    int x=devide(w);
    printf("%d\n",y*x);
}